﻿<!DOCTYPE html>
<!--总体评估模板管理列表-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/js/common.js"></script>
   
    <style>
        body {
            padding-bottom: 10px;
        }

        .vue-treeselect_style .vue-treeselect__control {
            height: 100%;
            border: none;
            background: none;
        }

        .vue-treeselect__placeholder {
            top: -3px;
        }

        .vue-treeselect__single-value {
            top: -3px;
        }

        .vue-treeselect__input {
            height: 27px !important;
        }
    </style>
    <style>
        .vue-treeselect__control {
            height: 100%;
            border: none;
            background: none;
        }

        .vue-treeselect__placeholder {
            top: -3px;
        }

        .vue-treeselect__single-value {
            top: -3px;
        }
        .widthZ{
            background-color: #FFF;
        }
            .widthZ .el-input__inner {
                width: 0px !important;
                display: initial;
                border-color: #FFF;
            }
        /*.widthZ .el-input-group__prepend {
            width: 150px !important;
        }*/

        .widthZ .el-select {
            width: 100% !important;
            margin:0px !important;
        }

            .widthZ .el-input-group__append {
                margin-left: 10px;
                background-color: #FFF;
                width: 200px !important;
                display: inline;
                float: left;
            }

        .widthZ .el-select .el-input__inner {
            width: 100% !important;
        }
    </style>
    
    <!-- 行内编辑 css-->
    <style>
        .tb-edit .el-input {
            display: none
        }

        .tb-edit .current-row .el-input {
            display: block
        }

            .tb-edit .current-row .el-input + span {
                display: none
            }

        .tb-edit .el-select {
            display: none
        }

        .tb-edit .current-row .el-select {
            display: block
        }

            .tb-edit .current-row .el-select + span {
                display: none
            }

        .xian {
            display: block;
            text-align: center;
        }

        .yin {
            display: none;
            text-align: center;
        }

        .lineMust {
            position: absolute;
            right: 15px;
            bottom: 6px;
            bottom: 3px\0 !important;
            /* 兼容ie */
        }
    </style>
    <!-- 行内编辑 css-->
    <style>
        .el-table__body-wrapper table tbody tr td {
            text-align: center;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak class="popupW50">
        <el-form ref="form" :inline="true" label-position="right" label-width="100px" :model="formInline"
                 class="demo-form-inline" style="margin-bottom: 15px;">

            <el-row>
                <el-col class="head-tool">

                    <div class="new_title fl"><strong><img src="/static/images/icon1.png" />总体评估模板管理列表</strong></div>
                    <span>
                        <!--<btn text="添加检查项目" imgsrc="/static/images/add.png" linetype="3" @click="add">
                </btn>-->
                        <!-- <btn :text="col.btnAdd" linetype="3" @click="UserInput('tj')"></btn> -->
                        <!-- <btn-uploadfile-list url="xxxx" linetype="3"></btn-uploadfile-list>
                <btn-export-list url="xxxx" :forminline="this.formInline" linetype="3">
                </btn-export-list> -->
                        <!--<btn :text="col.btnDelete" linetype="4" @click="onDelete"></btn>-->
                    </span>
                </el-col>
            </el-row>
            <el-row>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    <div> {{OverallAssessmentType.Type+mark.m}}</div>
                                </template>
                                <el-select @visible-change="visibleChange" v-model="formInline.model.assessTypeId" slot="suffix"
                                           :placeholder="OverallAssessmentType.Type" @change="onSubmit">
                                    <!-- <el-option :label="Type[0].value" value=""></el-option> -->
                                    <el-option v-for="item in Type" :label="item.value" :value="item.id">
                                    </el-option>
                                </el-select>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-button type="primary" @click="add">添加检查项目</el-button>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>


            <el-table ref="table" stripe @current-change="tableHandleCurrentChange" class="tb-edit"
                      :data="ListItem.tableData" :row-key="getRowKeys"  border
                      @selection-change="handleSelectionChange" row-style="height:10px" style="width: 100%;">
                <el-table-column type="selection" align="center" width="55">
                </el-table-column>
                <el-table-column type="index" :label="ContractorDirectory.SerialNumber" :index="indexMethod" width="50"
                                 show-overflow-tooltip="true"></el-table-column>


                <!-- 行内编辑 html-->
                <el-table-column :label="OverallAssessmentType.CheckProject">
                    <template scope="scope">
                        <el-input size="mini" v-model="scope.row.checkProject" placeholder="请输入内容">
                        </el-input>
                        <span>{{scope.row.checkProject}}</span>
                        <span class="lineMust" v-if="scope.row.checkProject.length<=0">
                            <!-- 必填项添加 -->
                            <img src="/static/images/exclamation.png" alt="">
                        </span>
                    </template>
                </el-table-column>
                <el-table-column :label="OverallAssessmentType.Points">
                    <template scope="scope">
                        <el-input size="mini" v-model="scope.row.weightPoints" placeholder="请输入内容">
                        </el-input>
                        <span>{{scope.row.weightPoints}}</span>
                        <span class="lineMust" v-if="scope.row.weightPoints.length<=0">
                            <!-- 必填项添加 -->
                            <img src="/static/images/exclamation.png" alt="">
                        </span>
                    </template>
                </el-table-column>

                <el-table-column width="90" prop="update" :label="col.stWork">
                    <template slot-scope="scope">
                        <span class="start xian">
                            <button type="button" class="elst-bt-xg" @click=Edit('xg',scope.row.id,scope.$index)>
                                <i class="el-icon-edit"></i>
                            </button>
                        </span>
                        <span class="end yin">
                            <button type="button" class="elst-bt-xg " @click="Save(scope.$index, scope.row);">
                                <i class="el-icon-circle-check-outline"></i>
                                <!-- 保存 -->
                            </button>
                            <button type="button" class="elst-bt-xg " @click="Back(scope.$index, scope.row)">
                                <i class="el-icon-circle-close-outline"></i>
                                <!-- 撤销 -->
                            </button>
                        </span>
                    </template>
                </el-table-column>
                <!-- 行内编辑 html-->
                <el-table-column width="90" label="删除" align="center">
                    <template slot-scope="scope">
                        <button type="button" class="elst-bt-xg"
                                @click="deleteRow(scope.row.id,scope.$index)">
                            <i class="el-icon-delete"></i>
                        </button>
                    </template>
                </el-table-column>
                <el-table-column prop="id" width="1" :show-overflow-tooltip="true">
                    <template slot-scope="scope">
                        <span>{{scope.row.id}}</span>
                    </template>
                </el-table-column>


                <!-- <el-table-column prop="OverallAssessmentTypeName" :label="OverallAssessmentType.OverallAssessmentTypeName">
        </el-table-column>
        <el-table-column prop="editor" :label="OverallAssessmentType.editor">
        </el-table-column>

        <el-table-column prop="editorTime" :label="OverallAssessmentType.editorTime">
        </el-table-column>
        <el-table-column width="53" prop="update" :label="col.btnUpdate" fixed="right">
            <template slot-scope="scope">
                <button type="button" class="elst-bt-xg" @click=UserInput('xg',scope.row.id)>
                    <i class="el-icon-edit"></i>
                </button>
            </template>
        </el-table-column> -->
            </el-table>
            <el-row style="margin-top:15px;">
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-button type="primary" @click="add2">添加审批领导</el-button>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
            <el-table ref="table2" id="table2" stripe @current-change="tableHandleCurrentChange2" class="tb-edit"
                      :data="tableData2" :row-key="getRowKeys"  border
                      @selection-change="handleSelectionChange2" row-style="height:10px" style="width: 100%;">
                <el-table-column type="selection" align="center" width="55">
                </el-table-column>
                <el-table-column type="index" :label="ContractorDirectory.SerialNumber" :index="indexMethod" width="50"
                                 show-overflow-tooltip="true"></el-table-column>


                <!-- 行内编辑 html-->
                <el-table-column label="岗位">
                    <template scope="scope">
                        <el-input size="mini" class="widthZ">
                            <el-select @visible-change="visibleChange" v-model="scope.row.dutyId" slot="append" placeholder="请选择">
                                <el-option label="请选择" value=""></el-option>
                                <el-option v-for="item in duties" :label="item.name" :value="item.name"></el-option>
                            </el-select>
                        </el-input>
                        <span>{{scope.row.dutyId}}</span>

                    </template>
                </el-table-column>


                <el-table-column width="90" prop="update" :label="col.stWork">
                    <template slot-scope="scope">
                        <span class="start xian">
                            <button type="button" class="elst-bt-xg" @click=Edit2('xg',scope.row.id,scope.$index)>
                                <i class="el-icon-edit"></i>
                            </button>
                        </span>
                        <span class="end yin">
                            <button type="button" class="elst-bt-xg " @click="Save2(scope.$index, scope.row);">
                                <i class="el-icon-circle-check-outline"></i>
                                <!-- 保存 -->
                            </button>
                            <button type="button" class="elst-bt-xg " @click="Back2(scope.$index, scope.row)">
                                <i class="el-icon-circle-close-outline"></i>
                                <!-- 撤销 -->
                            </button>
                        </span>
                    </template>
                </el-table-column>
                <!-- 行内编辑 html-->
                <el-table-column width="90" label="删除" align="center">
                    <template slot-scope="scope">
                        <button type="button" class="elst-bt-xg"
                                @click="deleteRow2(scope.row.id,scope.$index)">
                            <i class="el-icon-delete"></i>
                        </button>
                    </template>
                </el-table-column>
                <el-table-column prop="id" width="1" :show-overflow-tooltip="true">
                    <template slot-scope="scope">
                        <span>{{scope.row.id}}</span>
                    </template>
                </el-table-column>

            </el-table>
            <!--<el-row type="flex" justify="end">
        <el-pagination ref="page" @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :current-page="ListItem.currentPage" :page-sizes="ListItem.pagesizes" :page-size="ListItem.pagesize"
            :layout="ListItem.layout" :total="ListItem.total">
        </el-pagination>
    </el-row>-->
            <el-row type="flex" justify="end" style="padding-top:5px;">

                <el-button type="primary" @click="onSubmitForm2">{{col.btnSave}}</el-button>

            </el-row>
        </el-form>
            <el-dialog title="总体评估考核类型管理" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="80%"
                       height="80%" top="10vh" fullscreen="true">
                <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
            </el-dialog>
    </div>
    <script type="text/javascript">
        //获取分页数据
        function GetPageData1(mythis, currentIndex, url) {
            var currObj = mythis;
            currObj.delId = [];
            if (currObj.formInline.model.assessTypeId == null || currObj.formInline.model.assessTypeId == "" || currObj.formInline.model.assessTypeId == undefined) {
                currObj.ListItem.tableData = [];
                currObj.ListItem.total = 0;

            } else {


                myAjax("post", currObj, url, { model: currObj.formInline.model, offset: 0, limit: 100 }, function (response) {
                    //console.log(response);
                    if (response.data.pageData.length == 0) {
                        currObj.ListItem.tableData = [];
                        currObj.ListItem.total = 0;
                    } else {
                        currObj.ListItem.tableData = response.data.pageData;
                        currObj.ListItem.total = response.data.pageData.length;
                    }
                });
            }
        }
        function GetPageData2(mythis, currentIndex, url) {
            var currObj = mythis;
            currObj.delId2 = [];
            if (currObj.formInline.model.assessTypeId == null || currObj.formInline.model.assessTypeId == "" || currObj.formInline.model.assessTypeId == undefined) {
                currObj.tableData2 = [];
                currObj.ListItem.total2 = 0;

            } else {


                myAjax("post", currObj, url, {
                    model: { constructionCategory: currObj.formInline.model.assessTypeId}, offset: 0, limit: 100 }, function (response) {
                    //console.log(response);
                    if (response.data.pageData.length == 0) {
                        currObj.tableData2 = [];

                    } else {
                        var list = response.data.pageData;
                        //for (var i = 0; i < list.length; i++) {
                        //    var saveModel = list[i];
                        //    for (var z = 0; z < currObj.duties.length; z++) {
                        //        if (currObj.duties[z].id == saveModel.dutyId) {
                        //            list[i].dutyId = currObj.duties[z].name;

                        //        }
                        //    }
                        //}
                        currObj.tableData2 = list;
                    
                         for (var i = 0; i < currObj.tableData2.length; i++) {
                            var saveModel = currObj.tableData2[i];
                            for (var z = 0; z < currObj.duties.length; z++) {
                                if (currObj.duties[z].id == saveModel.dutyId) {
                                    saveModel.dutyId = currObj.duties[z].name;

                                }
                            }
                        }
                    }
                });
            }
        }
        app = new Vue({
            el: '#app',
            data: function () {
                return {
                    Type: [],
                    duties: [],
                    Form: {
                        id: guidEmpty,
                        assessTypeId: '',
                        checkProject: '',
                        weightPoints: '',
                    },
                    Form2: {
                        id: guidEmpty,
                        constructionCategory:'',
                        dutyId: '',
                        approveOrder: ''
                    },
                    ConstructionCategory: [],
                    ListItem: ListItem,
                    tableData2:[],
                    formInline: {
                        model: {
                            assessTypeId: '',
                            OverallAssessmentTypeName: '',
                            editor: '',
                            editorTime: ''
                        },
                        offset: 0,
                        limit: 10
                    },
                    checkProjectTemp: '',
                    pointsTemp: '',
                    delId: [],
                    delId2:[],
                    tempId: guidEmpty,
                    dutyIdTemp:'',
                }
            }, created: function () {
                var currApp = this;
                window.onresize = function () {
                    currApp.ListItem.tableHeight = window.innerHeight -
                        currApp.$refs.table.$el.offsetTop - 60;
                    if (currApp.ListItem.tableHeight < 112) {
                        currApp.ListItem.tableHeight = 112;
                    }
                }
            },
            mounted: function () {
                ////获取下拉菜单内容
                //this.ConstructionCategory = getDicData('25');
                this.getTypeList();
                this.getSysDuty();
                //初始化数据
                this.GetPageData(1);
                //列表高度自适应
                tablehigh(this);
                //this.Type = getDicData('29');

                //this.formInline.model.Type = this.Type[0].value;
                if (this.Type == null || this.Type == undefined) { } else {
                    if (this.Type.length > 0) { this.formInline.model.assessTypeId = this.Type[0].id; }
                    //this.formInline.model.Type = this.Type[0].value;
                }
            },
            created: function () {
                setTimeout(this.onSubmit, 100);

            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                //初始化承包商类型
                getTypeList: function () {
                    var mythis = this;
                    myAjax("post", this, '/api/CBS_DayCheckItem/CBSsglbGetList', { model: { category: 'cbssglb' }, offset: 0, limit: 100 }, function (response) {
                        mythis.Type = response.data;

                        //console.log(response.data.pageData);
                    }, false);
                },
                //岗位集合
                getSysDuty: function () {
                    var mythis = this;
                    myAjax("post", this, '/api/SysDuty/GetList', { model: { Name: '', CreateFactory: null }, offset: 0, limit: 10 }, function (response) {
                        mythis.duties = menuHelper(response.data.pageData, guidEmpty)
                    }, false);
                },
                indexMethod: function (index) {
                    return (this.ListItem.currentPage - 1) * this.ListItem.pagesize + index + 1;
                },
                GetData: function () {
                    this.GetPageData();
                },
                // 行内编辑 js
                add: function (formName) {
                    if ($('#tbody tr').attr("class") == "el-table__row current-row") {
                        showMessage(msg.EditingNotCompleted, 'error');
                    } else {
                        //this.Form.CheckProject = '';//添加是清空录入数据的，每一项都要有
                        //this.Form.Points = '';//添加是清空录入数据的，每一项都要有
                        //this.Form.Type = this.formInline.model.Type;//添加是清空录入数据的，每一项都要有
                        var newObj = {
                            checkProject: '',//添加是清空录入数据的，每一项都要有
                            weightPoints: ''
                        }
                        $('.el-table__row').removeClass('current-row');
                        $('.el-table__row span.end').removeClass('xian');
                        $('.el-table__row span.end').addClass('yin');
                        $('.el-table__row span.start').removeClass('yin');
                        $('.el-table__row span.start').addClass('xian');
                        //this.ListItem.tableData.unshift(this.Form);
                        this.ListItem.tableData.unshift(newObj);
                        setTimeout(function () {
                            $('.el-table__row:eq(0)').addClass('current-row');
                            $('.el-table__row:eq(0) span.end').removeClass('yin');
                            $('.el-table__row:eq(0) span.end').addClass('xian');
                            $('.el-table__row:eq(0) span.start').removeClass('xian');
                            $('.el-table__row:eq(0) span.start').addClass('yin');
                        }, 100);
                    }
                },
                //修改
                Edit: function (val, id, index) {
                    var tlist = this.ListItem.tableData;
                    this.checkProjectTemp = tlist[index].checkProject;
                    this.pointsTemp = tlist[index].weightPoints;
                    $('.el-table__row').removeClass('current-row');
                    $('.el-table__row:eq(' + index + ')').addClass('current-row');
                    $('.el-table__row span.end').removeClass('xian');
                    $('.el-table__row span.end').addClass('yin');
                    $('.el-table__row span.start').removeClass('yin');
                    $('.el-table__row span.start').addClass('xian');
                    $('.el-table__row:eq(' + index + ') span.end').removeClass('yin');
                    $('.el-table__row:eq(' + index + ') span.end').addClass('xian');
                    $('.el-table__row:eq(' + index + ') span.start').removeClass('xian');
                    $('.el-table__row:eq(' + index + ') span.start').addClass('yin');
                },
                // 保存
                Save: function (a, b) {
                    if (!b.checkProject || !b.weightPoints) {
                        showMessage(msg.NoMust, 'error');
                    } else {
                        //this.onSubmitForm('form', b);

                        $('.el-table__row').removeClass('current-row');
                        console.log("a", a);
                        console.log("b", b);
                        $('.el-table__row span.end').removeClass('xian');
                        $('.el-table__row span.end').addClass('yin');
                        $('.el-table__row span.start').removeClass('yin');
                        $('.el-table__row span.start').addClass('xian');
                        ////初始化数据
                        //// this.GetPageData(1);
                        //setTimeout(this.GetPageData, 100);
                    }
                },

                Back: function (a, b) {
                    if (this.checkProjectTemp != "" || this.pointsTemp != "") {
                        b.checkProject = this.checkProjectTemp;
                        b.weightPoints = this.pointsTemp;
                        this.checkProjectTemp = "";
                        this.pointsTemp = "";
                        $('.el-table__row').removeClass('current-row');
                        $('.el-table__row span.end').removeClass('xian');
                        $('.el-table__row span.end').addClass('yin');
                        $('.el-table__row span.start').removeClass('yin');
                        $('.el-table__row span.start').addClass('xian');

                    } else {
                        $('.el-table__row').removeClass('current-row');
                        $('.el-table__row span.end').removeClass('xian');
                        $('.el-table__row span.end').addClass('yin');
                        $('.el-table__row span.start').removeClass('yin');
                        $('.el-table__row span.start').addClass('xian');
                        this.ListItem.tableData.splice(a, 1);
                    }
                    ////初始化数据
                    //this.GetPageData(1);
                },
                deleteRow: function (id, delrow) {
                    var mythis = this;
                    //this.$confirm(' 是否确认继续?', '提示', {
                    //    confirmButtonText: '确定',
                    //    cancelButtonText: '取消',
                    //    type: 'warning'
                    //}).then(function () {
                    if (id == mythis.tempId || id == null || id == "") {
                        this.$confirm(' 是否确认继续?', '提示', {
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',
                            type: 'warning'
                        }).then(function () {
                            var list = mythis.ListItem.tableData;
                            list.splice(delrow, 1);
                        }).catch(function () {
                            showMessage("已取消删除!");
                        });
                    } else {
                        this.$confirm(' 是否确认继续?', '提示', {
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',
                            type: 'warning'
                        }).then(function () {
                            mythis.delId.push(id);
                            var list = mythis.ListItem.tableData;
                            list.splice(delrow, 1);
                        }).catch(function () {
                            showMessage("已取消删除!");
                        });
                    }


                    //}).catch(function () {
                    //    showMessage("已取消删除!");
                    //});
                },
                onSubmitForm: function (formName, obj) {
                    var mythis = this;
                    this.$refs[formName].validate(function (valid) {
                        onSubmitForm(this, '/api/OverallAssessmentType/Save', obj);
                        //验证通过
                        // if (valid) {
                        //     onSubmitForm(this, '/api/OverallAssessmentType/Save', obj);
                        // } else {
                        //     //验证失败
                        //     return false;
                        // }
                    });
                },
                onSubmitForm2: function () {

                    var mythis = this;
                    var sumS = 0;
                    //检查项目
                    for (var i = 0; i < mythis.ListItem.tableData.length; i++) {
                        sumS = parseFloat(sumS) + parseFloat(mythis.ListItem.tableData[i].weightPoints);
                    }
                    if (parseFloat(sumS) == 100) {

                        for (var i = 0; i < mythis.ListItem.tableData.length; i++) {
                            var saveModel = mythis.ListItem.tableData[i];
                            saveModel.assessTypeId = this.formInline.model.assessTypeId;
                            //onSubmitForm(this, '/api/CBS_TotalCheckItem/Save', saveModel);
                            myAjax("post", mythis, '/api/CBS_TotalCheckItem/Save', saveModel, function (response) {

                            }, false);
                        }
                        if (mythis.delId.length > 0) {
                            myAjax("post", mythis, '/api/CBS_TotalCheckItem/DeleteMuti', mythis.delId, function (response) {
                                mythis.delId = [];
                            });
                        }
                        

                    } else {
                        alert('权重分综合为100！');
                        return false;
                    }
                    //审批领导
                    for (var i = 0; i < mythis.tableData2.length; i++) {
                        var saveModel = mythis.tableData2[i];
                        saveModel.constructionCategory = this.formInline.model.assessTypeId;
                        for (var z = 0; z < this.duties.length;z++) {
                            if (this.duties[z].name == saveModel.dutyId) {
                                saveModel.dutyId = this.duties[z].id;
                                break;
                            }
                        }
                        saveModel.approveOrder = i;
                        myAjax("post", mythis, '/api/CBS_CategoryApproveDuty/Save', saveModel, function (response) {

                        }, false);
                    }
                    if (mythis.delId2.length > 0) {
                        myAjax("post", mythis, '/api/CBS_CategoryApproveDuty/DeleteMuti', mythis.delId2, function (response) {
                            mythis.delId = [];
                        });
                    }
                    for (var i = 0; i < mythis.tableData2.length; i++) {
                        var saveModel = mythis.tableData2[i];
                        for (var z = 0; z < mythis.duties.length; z++) {
                            if (mythis.duties[z].id == saveModel.dutyId) {
                                mythis.tableData2[i].dutyId = mythis.duties[z].name;

                            }
                        }
                    }
                    showMessage(msg.OperatingOk, 'success');
                },
                handblur: function () {
                    this.$refs.table.setCurrentRow(999);
                    console.log("c", 'c');
                },
                //table选中行handle
                tableHandleCurrentChange: function (currentRow) {
                    //this.currSeelctId = currentRow.id;
                    //this.currSeelctCell = currentRow;
                },
                // 行内编辑 js

                handleNodeClick: function (data) {
                    console.log(data);
                },
                closeDialog: function () { closeDialog(this); },
                //删除方法
                onDelete: function () { onDelete(this, '/api/CBS_TotalCheckItem/DeleteMuti'); },
                //列表选择触发
                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //Dialog展示
                UserInput: function (val, id) { DialogShow(this, val, "OverallEvaluationTemplateManagementInput.html", id); },
                //获取分页数据
                GetPageData: function (currentIndex) {

                    GetPageData2(this, currentIndex, '/api/CBS_CategoryApproveDuty/GetList'); 
                    GetPageData1(this, currentIndex, '/api/CBS_TotalCheckItem/GetList');
                },
                //查询方法
                onSubmit: function () {
                    GetPageData2(this, 1, '/api/CBS_CategoryApproveDuty/GetList');
                    GetPageData1(this, 1, '/api/CBS_TotalCheckItem/GetList');
                },
                //pagesize改变 触发方法
                handleSizeChange: function (val) { handleSizeChange(this, val); },
                //跳页触发方法
                handleCurrentChange: function (val) { handleCurrentChange(this, val); },
                //table选中行handle
                tableHandleCurrentChange2: function (currentRow) {
                    //this.currSeelctId2 = currentRow.id;
                    //this.currSeelctCell2 = currentRow;
                },
                //列表选择触发
                handleSelectionChange2: function (val) { handleSelectionChange2(this, val); },
                // 行内编辑 js
                add2: function (formName) {
                    if ($('#table2 tbody tr').attr("class") == "el-table__row current-row") {
                        showMessage(msg.EditingNotCompleted, 'error');
                    } else {
                        var newObj = {
                            dutyId: ''
                        }
                        $('#table2 .el-table__row').removeClass('current-row');
                        $('#table2 .el-table__row span.end').removeClass('xian');
                        $('#table2 .el-table__row span.end').addClass('yin');
                        $('#table2 .el-table__row span.start').removeClass('yin');
                        $('#table2 .el-table__row span.start').addClass('xian');
                        //this.ListItem.tableData.unshift(this.Form);
                        this.tableData2.unshift(newObj);
                        setTimeout(function () {
                            $('#table2 .el-table__row:eq(0)').addClass('current-row');
                            $('#table2 .el-table__row:eq(0) span.end').removeClass('yin');
                            $('#table2 .el-table__row:eq(0) span.end').addClass('xian');
                            $('#table2 .el-table__row:eq(0) span.start').removeClass('xian');
                            $('#table2 .el-table__row:eq(0) span.start').addClass('yin');
                        }, 100);
                    }
                },
                //修改
                Edit2: function (val, id, index) {
                    var tlist = this.tableData2;
                    this.dutyIdTemp = tlist[index].dutyId;
                    $('#table2 .el-table__row').removeClass('current-row');
                    $('#table2 .el-table__row:eq(' + index + ')').addClass('current-row');
                    $('#table2 .el-table__row span.end').removeClass('xian');
                    $('#table2 .el-table__row span.end').addClass('yin');
                    $('#table2 .el-table__row span.start').removeClass('yin');
                    $('#table2 .el-table__row span.start').addClass('xian');
                    $('#table2 .el-table__row:eq(' + index + ') span.end').removeClass('yin');
                    $('#table2 .el-table__row:eq(' + index + ') span.end').addClass('xian');
                    $('#table2 .el-table__row:eq(' + index + ') span.start').removeClass('xian');
                    $('#table2 .el-table__row:eq(' + index + ') span.start').addClass('yin');
                },
                // 保存
                Save2: function (a, b) {
                    if (!b.dutyId) {
                        showMessage(msg.NoMust, 'error');
                    } else {
                        //this.onSubmitForm('form', b);

                        $('#table2 .el-table__row').removeClass('current-row');
                        console.log("a", a);
                        console.log("b", b);
                        $('#table2 .el-table__row span.end').removeClass('xian');
                        $('#table2 .el-table__row span.end').addClass('yin');
                        $('#table2 .el-table__row span.start').removeClass('yin');
                        $('#table2 .el-table__row span.start').addClass('xian');
                        ////初始化数据
                        //// this.GetPageData(1);
                        //setTimeout(this.GetPageData, 100);
                    }
                },

                Back2: function (a, b) {
                    if (this.dutyIdTemp != "" ) {
                        b.dutyId = this.dutyIdTemp;
                        this.dutyIdTemp = "";
                        $('#table2 .el-table__row').removeClass('current-row');
                        $('#table2 .el-table__row span.end').removeClass('xian');
                        $('#table2 .el-table__row span.end').addClass('yin');
                        $('#table2 .el-table__row span.start').removeClass('yin');
                        $('#table2 .el-table__row span.start').addClass('xian');

                    } else {
                        $('#table2 .el-table__row').removeClass('current-row');
                        $('#table2 .el-table__row span.end').removeClass('xian');
                        $('#table2 .el-table__row span.end').addClass('yin');
                        $('#table2 .el-table__row span.start').removeClass('yin');
                        $('#table2 .el-table__row span.start').addClass('xian');
                        this.tableData2.splice(a, 1);
                    }
                    ////初始化数据
                    //this.GetPageData(1);
                },
                deleteRow2: function (id, delrow) {
                    var mythis = this;
                    //this.$confirm(' 是否确认继续?', '提示', {
                    //    confirmButtonText: '确定',
                    //    cancelButtonText: '取消',
                    //    type: 'warning'
                    //}).then(function () {
                    if (id == mythis.tempId || id == null || id == "") {
                        this.$confirm(' 是否确认继续?', '提示', {
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',
                            type: 'warning'
                        }).then(function () {
                            var list = mythis.tableData2;
                            list.splice(delrow, 1);
                        }).catch(function () {
                            showMessage("已取消删除!");
                        });
                    } else {
                        this.$confirm(' 是否确认继续?', '提示', {
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',
                            type: 'warning'
                        }).then(function () {
                            mythis.delId2.push(id);
                            var list = mythis.tableData2;
                            list.splice(delrow, 1);
                        }).catch(function () {
                            showMessage("已取消删除!");
                        });
                    }


                    //}).catch(function () {
                    //    showMessage("已取消删除!");
                    //});
                },
            }
        });
        //下拉树数据格式化
        function menuHelper(list, pid) {
            var result = [];
            if (list.length <= 0)
                return list;
            list.forEach(function (v, i) {
                var temp = {};
                for (var key in v) {
                    temp[key] = v[key];
                }
                temp.label = v.name;
                temp.parentId = temp.parentId ? temp.parentId : guidEmpty;
                var obj;
                if (temp.parentId == pid) {
                    obj = temp;
                    var nextObj = menuHelper(list, temp.id);
                    if (nextObj.length > 0) {
                        obj.children = nextObj;
                    }
                }
                if (obj)
                    result.push(obj)
            })
            return result;
        }
    </script>
</body>

</html>